home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / doom / cddk9605.zip / HEADERS.ARJ / SOUNDS.INT < prev    next >
Text File  |  1996-05-17  |  3KB  |  74 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  Name        : SOUNDS.PAS                                                 }
  4. {  Description : PC-Speaker routines                                        }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT Sounds;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. PROCEDURE Ring;
  21.   {
  22.   PURPOSE  : Simulates a telephone ring on the local computer.
  23.  
  24.   SEE ALSO : Siren
  25.   }
  26.  
  27.  
  28. PROCEDURE Siren(Resolution,Amplitude,Midline,DelayFactor,Count:Word);
  29.   {
  30.   PURPOSE  : Generates a cosine siren on the local computer.
  31.  
  32.   NOTES    : A cosine curve looks something like this:
  33.  
  34.               1    ∙  .                               .  ∙
  35.                    │     ∙                         ∙
  36.                    │       ∙                     ∙
  37.                    │        ∙                   ∙
  38.               0  ──┼───────────────────────────────────────
  39.                    │         ∙                 ∙
  40.                    │          ∙               ∙
  41.                    │            ∙           ∙
  42.              -1    │               ∙  .  ∙
  43.  
  44.                    0        π/2       π        3π/2      2π
  45.  
  46.              Notice that the cosine graph repeats one full cycle every
  47.              2π (6.28) units.  This is the basis for many different sirens.
  48.              The sound at any given point is calculated from this curve.
  49.  
  50.   PARAMS   :  Resolution  The cosine curve is divided into a large number
  51.                           of steps.  The siren cycles through each step and
  52.                           creates a sound based on the curve at that step.
  53.                           The number of steps is the resolution of the siren.
  54.  
  55.               Amplitude   Each step is multiplied by the amplitude.  Since
  56.                           the peaks of the curve have a maximum value of +1
  57.                           and a minimum value of -1, this generates an
  58.                           effective range of -Amplitude to +Amplitude.
  59.  
  60.               Midline     The middle frequency (i.e. the line through the
  61.                           middle of the curve).  The final range of the
  62.                           siren is Midline-Amplitude to Midline+Amplitude.
  63.  
  64.               Delay       This parameter allows you to tweak the speed of
  65.                           the siren, which is dependent of the clock speed
  66.                           of the CPU.  Adjust this factor if the siren
  67.                           sounds bad.
  68.  
  69.               Count       The number of times to repeat the siren.
  70.  
  71.   SEE ALSO : Ring
  72.   }
  73.  
  74.